home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / include / ray_3d.h < prev    next >
Encoding:
Text File  |  1995-03-25  |  2.4 KB  |  48 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    ray.h
  3. //    Date:                    9/22/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a ray
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include "point_3d.h"
  11. #include "vector_3d.h"
  12.  
  13. #ifndef    RAY
  14. #define    RAY
  15.  
  16. //------------------------------------------------------------------------------
  17. //    classes
  18. //------------------------------------------------------------------------------
  19. class    ray                                                                                                                                                //    ray class
  20. {                                                                                                                                                                //    begin
  21.     private:                                                                                                                                            //    members internal to this class only
  22.     protected:                                                                                                                                        //    members internal to this class hierarchy
  23.                 point_3d        origin;                                                                                                            //    the originating point_3d of the ray
  24.                 vector_3d    direction;                                                                                                        //    the direction vector_3d of the ray
  25.     public:                                                                                                                                                //    members available externally
  26.                 ray (const point_3d &origin, const vector_3d &direction);                                //    constructor
  27. const     point_3d     &Origin (void) const;                                                                                    //    return a reference to the origin point_3d of the ray
  28. const     vector_3d    &Direction (void) const;                                                                            //    return a reference to the direction vector_3d of the ray
  29.                 point_3d    IntersectionPoint (real distance) const;                                            //    compute the point_3d at which the intersection occurs
  30. };                                                                                                                                                            //    end
  31.  
  32. //------------------------------------------------------------------------------
  33. //    inlines
  34. //------------------------------------------------------------------------------
  35. inline    const     point_3d     &ray::Origin (void) const                                                            //    return a reference to the origin point_3d of the ray
  36. {                                                                                                                                                                //    begin
  37.     return origin;                                                                                                                                //    return the origin
  38. }                                                                                                                                                                //    end
  39.  
  40. inline    const     vector_3d     &ray::Direction (void) const                                                //    return a reference to the direction vector_3d of the ray
  41. {                                                                                                                                                                //    begin
  42.     return direction;                                                                                                                            //    return the direction
  43. }                                                                                                                                                                //    end
  44.  
  45. //------------------------------------------------------------------------------
  46.  
  47. #endif    //RAY
  48.